<?php /*a:2:{s:56:"D:\phpstudy_pro\yifei\muban\view\admin\cn\info\info.html";i:1755592631;s:48:"D:\phpstudy_pro\yifei\muban\view\admin\head.html";i:1755240736;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>导航管理</title>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/base.css">
<link rel="stylesheet" href="/static/admin/css/font.css">
<link rel="stylesheet" href="/static/admin/css/css.css">
<link rel="stylesheet" href="/static/admin/css/xadmin.css">
<link rel="stylesheet" href="/static/admin/css/image.css">
<script src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
<script type="text/javascript" src="/static/admin/js/fl.js"></script>
<script src="/static/admin/js/falan.js"></script>
<script>var lang = "<?php echo htmlentities((string) $lang); ?>"</script>
</head>
<body>
<div class="x-body">
    <div class="layui-form">
        <input type="text" id="id" name="id" value="<?php echo htmlentities((string) (isset($info['id']) && ($info['id'] !== '')?$info['id']:0)); ?>" style="display: none;">
        <div class="layui-form-item">
            <label class="layui-form-label">
                标题
            </label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="name" required lay-verify="required"
                       autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($info['name']) && ($info['name'] !== '')?$info['name']:'')); ?>"
                >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                封面图片
            </label>
            <div class="layui-input-inline">
                <input type="text" id="image_id" value="<?php echo htmlentities((string) (isset($info['image_id']) && ($info['image_id'] !== '')?$info['image_id']:0)); ?>" style="display:none;">
                <!--<input type="file" id="image-file" style="display: none;" onchange="imagefile(this)" accept="image/*">-->
                <img src="<?php echo htmlentities((string) (isset($info['image']) && ($info['image'] !== '')?$info['image']:'/static/admin/img/none.jpg')); ?>" id="image" onclick="imageselect('image_id','image')" style="max-width: 150px">
            </div>
        </div>
        <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label">-->
                <!--轮播图片-->
            <!--</label>-->
            <!--<div class="layui-input-inline" style="width: 600px">-->
                <!--<input type="file" id="images-array-file" style="display: none;" onchange="imagesfile(this)" accept="image/*">-->
                <!--<table class="table-images">-->
                    <!--<thead>-->
                        <!--<tr>-->
                            <!--<th>图片</th>-->
                            <!--<th>链接</th>-->
                            <!--<th>标题</th>-->
                            <!--<th>说明</th>-->
                            <!--<th>排序</th>-->
                            <!--<th>操作</th>-->
                        <!--</tr>-->
                    <!--</thead>-->
                    <!--<tbody id="image-tbody">-->
                        <!--<?php if(!(empty($info['images']) || (($info['images'] instanceof \think\Collection || $info['images'] instanceof \think\Paginator ) && $info['images']->isEmpty()))): ?>-->
                        <!--<?php if(is_array($info['images']) || $info['images'] instanceof \think\Collection || $info['images'] instanceof \think\Paginator): $i = 0; $__LIST__ = $info['images'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$value): $mod = ($i % 2 );++$i;?>-->
                        <!--<tr id="image-tr-<?php echo htmlentities((string) $value['id']); ?>">-->
                            <!--<td>-->
                                <!--<input type="text" id="image-input-<?php echo htmlentities((string) $value['id']); ?>" name="images_id" value="<?php echo htmlentities((string) $value['id']); ?>" style="display: none">-->
                                <!--<img src="<?php echo htmlentities((string) $value['image']); ?>" id="image-<?php echo htmlentities((string) $value['id']); ?>" onclick="saveimages('<?php echo htmlentities((string) $value['id']); ?>')">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" class="layui-input" id="image-url-<?php echo htmlentities((string) $value['id']); ?>" value="<?php echo htmlentities((string) (isset($value['url']) && ($value['url'] !== '')?$value['url']:'')); ?>">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" class="layui-input" id="image-title-<?php echo htmlentities((string) $value['id']); ?>" value="<?php echo htmlentities((string) (isset($value['title']) && ($value['title'] !== '')?$value['title']:'')); ?>">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" class="layui-input" id="image-info-<?php echo htmlentities((string) $value['id']); ?>" value="<?php echo htmlentities((string) (isset($value['info']) && ($value['info'] !== '')?$value['info']:'')); ?>">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="number" class="layui-input" id="image-sort-<?php echo htmlentities((string) $value['id']); ?>" value="<?php echo htmlentities((string) (isset($value['sort']) && ($value['sort'] !== '')?$value['sort']:'')); ?>">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<a href="javascript:;" onclick="save_image('<?php echo htmlentities((string) $value['id']); ?>')">修改</a>-->
                                <!--<a href="javascript:;" onclick="del_image('<?php echo htmlentities((string) $value['id']); ?>')">删除</a>-->
                            <!--</td>-->
                        <!--</tr>-->
                        <!--<?php endforeach; endif; else: echo "" ;endif; ?>-->
                        <!--<?php endif; ?>-->
                        <!--<tr id="image-tr-0">-->
                            <!--<td>-->
                                <!--<input type="text" id="image-input-0" style="display: none">-->
                                <!--<img src="/static/admin/img/none.jpg" id="image-0" onclick="addimages()">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" class="layui-input" id="image-url-0">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" id="image-title-0" class="layui-input">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="text" id="image-info-0" class="layui-input">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<input type="number" id="image-sort-0" class="layui-input" value="0">-->
                            <!--</td>-->
                            <!--<td>-->
                                <!--<a href="javascript:;" onclick="save_image(0)">添加</a>-->
                            <!--</td>-->
                        <!--</tr>-->
                    <!--</tbody>-->
                <!--</table>-->
            <!--</div>-->
        <!--</div>-->

        <div class="layui-form-item">
            <label class="layui-form-label">
                所属目录
            </label>
            <div class="layui-input-inline">
                <select id="pid">
                    <?php if(is_array($all) || $all instanceof \think\Collection || $all instanceof \think\Paginator): $i = 0; $__LIST__ = $all;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$value): $mod = ($i % 2 );++$i;?>
                    <option value="<?php echo htmlentities((string) $value['id']); ?>" <?php if(!(empty($info['pid']) || (($info['pid'] instanceof \think\Collection || $info['pid'] instanceof \think\Paginator ) && $info['pid']->isEmpty()))): if($info['pid'] == $value['id']): ?> selected <?php endif; ?> <?php endif; ?>> <?php echo htmlentities((string) $value['name']); ?></option>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                简单介绍
            </label>
            <div class="layui-input-inline">
                <input type="text" id="info" name="name" class="layui-input" value="<?php echo htmlentities((string) (isset($info['info']) && ($info['info'] !== '')?$info['info']:'')); ?>">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                内容
            </label>
            <div class="layui-input-inline">
                <script type="text/javascript" charset="utf-8" src="/ueditor-plus/dist/ueditor.config.js"></script>
                <script type="text/javascript" charset="utf-8" src="/ueditor-plus/dist/ueditor.all.js"></script>
                <script type="text/javascript" charset="utf-8" src="/ueditor-plus/lang/zh-cn/zh-cn.js?7a537435"></script>
                <script id="editor" type="text/plain" style="width:800px;height:500px;">
                    <?php if(!(empty($info['content']) || (($info['content'] instanceof \think\Collection || $info['content'] instanceof \think\Paginator ) && $info['content']->isEmpty()))): ?><?php echo $info['content']; ?><?php endif; ?>
                </script>
                <script type="text/javascript">
                // 初始化编辑器
                var ue = UE.getEditor('editor');
                </script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                确认
            </button>
        </div>
    </div>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        //监听提交
        form.on('submit(add)', function(){
            let message = {
                name:document.getElementById('name').value,
                // url:document.getElementById('url').value,
                // list_template:document.getElementById('list_template').value,
                // info_template:document.getElementById('info_template').value,
                // images_id:getimagesid(),
                nav_id:document.getElementById('pid').value,
                image_id:document.getElementById('image_id').value,
                // web_type:document.getElementById('web_type').value,
                // isshow:document.getElementById('isshow').value,
                // pid:document.getElementById('pid').value,
                content:ue.getContent()
            };
            console.log(message);
            //发异步，把数据提交给php
            post('/sys/info/save?id=<?php echo htmlentities((string) (isset($info['id']) && ($info['id'] !== '')?$info['id']:0)); ?>',message);
        });
    });
    function post_result(res){
        layer.alert("操作成功", {icon: 6},function () {
            // 获得frame索引
            var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            parent.layer.close(index);
            parent.location.reload();
        });
    }
</script>
</body>
</html>